<!-- <navigator hover-class="none" url="/pages/shopDetails/shopDetails?pid={{prd_item.id}}&item_id={{prd_item.default_item_id}}"> -->

<!-- </navigator> -->
<template lang="html">
  <div :class="!is_vip ? 'c_prd_item h50' : 'c_prd_item'" @click="goBuy">
    <img class="prd_img" v-bind:src="prd_item.product_image" mode="aspectFill"/>
    <div class="prd_info">
      <h2 class="prd_title">{{prd_item.product_short_name}}</h2>
      <div class="prd_seat">
        <div class="prd_tips">{{prd_item.product_tips}}</div>
        <div class="prd_tag">
          <div class="discount" v-for="(item, key) in prd_item.activity_tab_names" v-bind:key="key">{{item}}</div>
        </div>
      </div>
      <div class="prd_price_c">
        <span :class="is_vip? 'buy_price' : 'buy_price no_vip'">¥{{prd_item.activity && prd_item.activity.activity_price ? prd_item.activity.activity_price : prd_item.product_unit_price}}</span>
        <div class="price_icon" v-if="is_vip ? true ? discount : true : false">/</div>
        <span :class="is_vip ? 'buy_tips' : 'buy_tips no_vip'">{{is_vip  ?  discount ?  "赚" + discount : '' : '￥'+ prd_item.product_market_price}}</span>
      </div>
      <div class="prd_info_bottom">
        <div class="prd_item_btns">
          <div class="buy_btn">立即抢购</div>
          <!-- <div class="buy_btn"  v-if="discount ? is_vip ? false : true : true">立即抢购</div> -->
          <!-- <div class="push_prd" catchtap="pushPrd" v-if="is_vip && discount">发素材</div> -->
          <!-- <div class="share_prd" v-on:click.stop="sharePrd" v-if="is_vip && discount">分享赚</div> -->
        </div>
      </div>
    </div>
    <div class="join_tips" v-if="!is_vip">
      <div class="vip_icon"></div>
      <span>加入会员自购/分享预计可返利{{discount}}元</span>
      <!-- <div class="more"></div> -->
    </div>
    <van-popup v-model="show" get-container="body" position="bottom">
      <div class="share_dis">
        <h3>分享赚现金返利</h3>
        <div class="vip_tag"><span>会员特权</span></div>
        <div class="shre_step">
          <ul>
            <li></li>
            <li></li>
            <li></li>
          </ul>
        </div>
      </div>
    </van-popup>
  </div>
</template>

<script>
export default {
  props: ['prd_item', 'user_info'],
  data () {
    return {
      discount: 0,
      is_vip: false,
      show: false
    }
  },
  created () {
    if (this.prd_item.discount) {
      this.discount = parseFloat(this.prd_item.discount)
    }
    if (this.user_info && this.user_info.lev_code === 'COMMON_USER') {
      this.is_vip = false
    } else if (this.user_info.lev_code !== 'COMMON_USER') {
      this.is_vip = true
    }
  },
  methods: {
    sharePrd () {
      this.show = !this.show
    },
    goBuy () {
      let isMini = sessionStorage.getItem('isMini')
      let item = this.prd_item
      let params = '?pid=' + item.product_id + '&item_id=' + item.default_item_id
      if (isMini) {
        window.wx.miniProgram.navigateTo({ url: '/pages/shopDetails/shopDetails' + params })
      } else {
        this.$router.push('/main/shopDetails' + params)
      }
    }
  }
}
</script>

<style lang="css" scoped>
</style>
